/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * JAdminCatedratico.java
 *
 * Created on 11-jul-2012, 16:23:43
 */

package interfaz;
import Clases.Catedratico;
import Controladores.CatedraticoJpaController;
import Controladores.CatedraticoPersonalizado;
import Clases.Usuario;
import Controladores.UsuarioJpaController;
import Controladores.UsuarioPersonalizado;
import escuela.conexion;
import escuela.exceptions.IllegalOrphanException;
import escuela.exceptions.NonexistentEntityException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.swing.JFrame;
import javax.swing.JOptionPane;
import javax.swing.table.DefaultTableModel;

/**
 *
 * @author Jose
 */
public class JAdminCatedratico extends javax.swing.JDialog {
     Mensajes msj = new Mensajes(this);
    conexion cnx = conexion.ObtenerInstancia();
    EntityManagerFactory emf = cnx.ObtenerEMF();
     CatedraticoPersonalizado catedraticos = new CatedraticoPersonalizado(emf);
     short sidCa=0;
    int sban=1;
    boolean sexistend=true;

    /** Creates new form JAdminCatedratico */
    public JAdminCatedratico(java.awt.Frame parent, boolean modal) {
        super(parent, modal);
        initComponents();
        this.setLocationRelativeTo(null);
        this.FechaNacimiento.setCalendar(Calendar.getInstance());
        if(catedraticos.pTodosLosCatedraticos().isEmpty()){
            sexistend=false;
        } else{
            CargarIdCatedratico();
            CargarDatosEdicion();
            CargarLista();
        }
    }
        private void CargarIdCatedratico(){
        List<Catedratico> Idc = catedraticos.pTodosLosCatedraticos();
        for(Catedratico ids: Idc){
            this.IdCatedratico.addItem(ids.getIdCatedratico());
            //System.out.println(cod.getCodigoPersonal());
        }

    }
        private void CargarDatosEdicion(){
        List<Catedratico> catselec = catedraticos.pBuscarPorId(this.IdCatedratico.getSelectedItem()+"");
        Catedratico catedraticoseleccionado = catselec.get(0);
        sidCa = catedraticoseleccionado.getIdCatedratico();
        this.EditNombre.setText(catedraticoseleccionado.getNombres());
        this.EditApellido.setText(catedraticoseleccionado.getApellidos());
        this.EditFechaNacimiento.setDate(catedraticoseleccionado.getFechaNacimiento());
        this.EditProfesion.setText(catedraticoseleccionado.getProfesion());
        this.EditTelefono.setText(catedraticoseleccionado.getTelefono());
        this.EditDireccion.setText(catedraticoseleccionado.getDireccion());
        this.EditEmail.setText(catedraticoseleccionado.getEmail());


        if(catedraticoseleccionado.getVigente()){
            this.VigenteSi.setSelected(true);
        }else
            this.VigenteNo.setSelected(true);
    }
         private void CargarLista(){
        MiModelo modelo = new MiModelo();
        List<Catedratico> listacatedratico;
        if(this.Buscadatos.getSelectedIndex()==0){
            listacatedratico = catedraticos.pTodosLosCatedraticos();
        }else if(this.Buscadatos.getSelectedIndex()==1){
            listacatedratico = catedraticos.pCatedraticosHabilitados();
        }else {
            listacatedratico = catedraticos.pCatedraticosDeshabilitados();
        }
        modelo.addColumn("Identificador");
        modelo.addColumn("Nombre");
        modelo.addColumn("Apellido");
        modelo.addColumn("Fecha de Nacimiento");
        modelo.addColumn("Profesion");
        modelo.addColumn("Telefono");
        modelo.addColumn("Direccion");
        modelo.addColumn("Email");
        Object[] filas = new Object [8];
        for(Catedratico sdatos: listacatedratico){
            filas[0]=sdatos.getIdCatedratico();
            filas[1]=sdatos.getNombres();
            filas[2]=sdatos.getApellidos();
            SimpleDateFormat fecha = new SimpleDateFormat("dd/MM/yyyy");
            filas[3]=fecha.format(sdatos.getFechaNacimiento());
            filas[4]=sdatos.getProfesion();
            filas[5]=sdatos.getTelefono();
            filas[6]=sdatos.getDireccion();
            filas[7]=sdatos.getEmail();
            modelo.addRow(filas);
        }
        this.Listacatedratico.setModel(modelo);

    }
         /**
          * Este que la tabla no puda ser editada
          */
         public class MiModelo extends DefaultTableModel
    {
        @Override
       public boolean isCellEditable (int row, int column)
       {
           return false;
       }
    }
          /**
           *  Este procedimiento se encarga de ingresar los datos de un catedratico
           */
          public void IngresarCatedratico(){
              Catedratico ingresocat = new Catedratico();
              CatedraticoJpaController control = new CatedraticoJpaController(emf);
              Usuario ingresausuario = new Usuario();
              UsuarioJpaController controlu = new UsuarioJpaController(emf);
              ingresocat.setNombres(this.Nombre.getText());
              ingresocat.setApellidos(this.Apellido.getText());
              ingresocat.setFechaNacimiento(this.FechaNacimiento.getDate());
              ingresocat.setProfesion(this.Profesion.getText());
              ingresocat.setTelefono(this.Telefono.getText());
              ingresocat.setDireccion(this.Direccion.getText());
              ingresocat.setEmail(this.Email.getText());
              ingresocat.setVigente(true);
              ingresausuario.setNombreUsuario(this.NombreUsuario.getText());
              ingresausuario.setContraseña(this.Contraseña.getText());
              if(this.AdminSi.isSelected()){
                 ingresausuario.setAdministrador(true);
              }else if(this.AdminNo.isSelected()){
               ingresausuario.setAdministrador(false);
              }
              
              ingresausuario.setHabilitado(true);
              controlu.create(ingresausuario);
              ingresocat.setUsuario(ingresausuario);

              control.create(ingresocat);


          }
          /**
           * Este permite editar los datos de un catedratiico
           */
          public void EditarCatedratico(){
              Catedratico editacat;
              CatedraticoJpaController control = new CatedraticoJpaController(emf);
              Usuario editausuario = new Usuario();
              UsuarioJpaController controlu= new UsuarioJpaController(emf);
              editacat=control.findCatedratico((Short) this.IdCatedratico.getSelectedItem());
              editacat.setNombres(this.EditNombre.getText());
              editacat.setApellidos(this.EditApellido.getText());
              editacat.setFechaNacimiento(this.EditFechaNacimiento.getDate());
              editacat.setProfesion(this.EditProfesion.getText());
              editacat.setTelefono(this.EditTelefono.getText());
              editacat.setDireccion(this.EditDireccion.getText());
              editacat.setEmail(this.EditEmail.getText());
              if(this.EditAdminNo.isSelected()){
                  editausuario=controlu.findUsuario(editacat.getUsuario().getIdUsuario());
                  editausuario.setAdministrador(false);
              }else if (this.EditAdminSi.isSelected()){
                  editausuario=controlu.findUsuario(editacat.getUsuario().getIdUsuario());
                  editausuario.setAdministrador(true);
              }
             // editacat.setVigente(true);
              if(this.VigenteNo.isSelected()){
                  editacat.setVigente(false);

                  editausuario=controlu.findUsuario(editacat.getUsuario().getIdUsuario());
                  editausuario.setHabilitado(false);

              }else if(this.VigenteSi.isSelected()){
                  editacat.setVigente(true);
                  editausuario=controlu.findUsuario(editacat.getUsuario().getIdUsuario());
                  editausuario.setHabilitado(true);
              }
              try{
               controlu.edit(editausuario);
               control.edit(editacat);
              }
              catch(Exception e){
                  System.out.println(e);
              }
                CargarLista();
          }
          private boolean VerificarCampos(byte panel){
        boolean respuesta =true;
        boolean[] campos = new boolean[5];
        if(panel==0){
            campos[0]=this.Nombre.getText().isEmpty();
            campos[1]=this.Apellido.getText().isEmpty();
            campos[2]=this.FechaNacimiento.getDate().toString().isEmpty();
            campos[3]=this.Profesion.getText().isEmpty();
            campos[4]=this.Telefono.getText().isEmpty();

        }else {
            campos[0]=this.EditNombre.getText().isEmpty();
            campos[1]=this.EditApellido.getText().isEmpty();
            campos[2]=this.EditFechaNacimiento.getDate().toString().isEmpty();
            campos[3]=this.EditProfesion.getText().isEmpty();
            campos[4]=this.EditTelefono.getText().isEmpty();


        }
        int num=0;
        for(boolean cam: campos){
            if(cam==true){
                respuesta=false;
                break;
            }
            num++;
        }
        if(respuesta==false){
            //System.out.print("entro");
            String mensaje="";
            switch(num){
                case 1: mensaje="Los apellidos son obligatorios"; break;
                case 0: mensaje="Los nombres son obligatorios"; break;
                case 4: mensaje="El Telefono es obligatoria"; break;
                case 3: mensaje="La Profesion es obligatorio"; break;
                case 2: mensaje="La fecha de nacimiento es obligatoria"; break;
            }
            msj.MensajeError(mensaje);
        }
        return respuesta;
    }// </editor-fold>
    private void ReiniciarCampos(byte campo){
        if(campo==0){
            this.Apellido.setText("");
            this.Nombre.setText("");
            this.Profesion.setText("");
            this.Telefono.setText("");
            this.FechaNacimiento.setCalendar(Calendar.getInstance());
        }else{

        }
    }
     private void Aceptar(){
        int seleccionado = this.AdCat.getSelectedIndex();
        switch(seleccionado){
            case 1: if(VerificarCampos((byte)0)){//Creacion

                        IngresarCatedratico();
                        msj.MensajeSeRealizo("El catedratico se ha ingresado exitosamente", "Ingresado");
                        sban=0;
                        this.IdCatedratico.removeAllItems();
                        CargarIdCatedratico();
                        sban=1;
                        CargarLista();
                    }
                    break;
            case 2: if(VerificarCampos((byte)1)){//Edicion
                        byte respuesta =msj.MensajeConfirmacion("¿Esta seguro que desea actualizar los datos de este Catedratico?");
                        switch(respuesta){
                            case 0: EditarCatedratico();
                                    msj.MensajeSeRealizo("Se ha actualizado el Catedratico exitosamente", "Actualizado");
                                    break;
                            case 2: System.out.println("Cancelar"); break;
                        }
                    }
                    break;
        }
    }
      private void Cancelar(){
        int seleccionado = this.AdCat.getSelectedIndex();
        byte respuesta;
        switch(seleccionado){
            case 1: respuesta =msj.MensajeConfirmacion("¿Esta seguro que cancelar el ingreso? Todos los datos se perderan");
                    switch(respuesta){
                        case 0: ReiniciarCampos((byte)0); break;
                        case 2: System.out.println("Cancelar"); break;
                    }
                    break;
            case 2: respuesta = msj.MensajeConfirmacion("¿Esta seguro que desea cancelar la actualizacion? Todos los datos que no esten guardados se perderan");
                    switch(respuesta){
                        case 0: CargarDatosEdicion(); break;
                        case 2: System.out.println("Cancelar"); break;
                    }
                    break;
        }
    }


    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        buttonGroup1 = new javax.swing.ButtonGroup();
        buttonGroup2 = new javax.swing.ButtonGroup();
        AdCat = new javax.swing.JTabbedPane();
        jPanel3 = new javax.swing.JPanel();
        jLabel27 = new javax.swing.JLabel();
        Buscadatos = new javax.swing.JComboBox();
        jScrollPane1 = new javax.swing.JScrollPane();
        Listacatedratico = new javax.swing.JTable();
        jPanel1 = new javax.swing.JPanel();
        jLabel1 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        jLabel4 = new javax.swing.JLabel();
        jLabel5 = new javax.swing.JLabel();
        jLabel6 = new javax.swing.JLabel();
        jLabel7 = new javax.swing.JLabel();
        Nombre = new javax.swing.JTextField();
        Apellido = new javax.swing.JTextField();
        Profesion = new javax.swing.JTextField();
        Telefono = new javax.swing.JTextField();
        Direccion = new javax.swing.JTextField();
        Email = new javax.swing.JTextField();
        FechaNacimiento = new com.toedter.calendar.JDateChooser();
        jLabel8 = new javax.swing.JLabel();
        jLabel17 = new javax.swing.JLabel();
        jLabel18 = new javax.swing.JLabel();
        jLabel19 = new javax.swing.JLabel();
        jLabel20 = new javax.swing.JLabel();
        jLabel22 = new javax.swing.JLabel();
        NombreUsuario = new javax.swing.JTextField();
        jLabel23 = new javax.swing.JLabel();
        Contraseña = new javax.swing.JTextField();
        jLabel24 = new javax.swing.JLabel();
        jLabel25 = new javax.swing.JLabel();
        jLabel26 = new javax.swing.JLabel();
        AdminSi = new javax.swing.JRadioButton();
        AdminNo = new javax.swing.JRadioButton();
        jPanel2 = new javax.swing.JPanel();
        jLabel9 = new javax.swing.JLabel();
        jLabel10 = new javax.swing.JLabel();
        jLabel11 = new javax.swing.JLabel();
        EditFechaNacimiento = new com.toedter.calendar.JDateChooser();
        EditProfesion = new javax.swing.JTextField();
        jLabel12 = new javax.swing.JLabel();
        jLabel13 = new javax.swing.JLabel();
        EditTelefono = new javax.swing.JTextField();
        jLabel14 = new javax.swing.JLabel();
        EditDireccion = new javax.swing.JTextField();
        jLabel15 = new javax.swing.JLabel();
        EditEmail = new javax.swing.JTextField();
        jLabel16 = new javax.swing.JLabel();
        VigenteNo = new javax.swing.JRadioButton();
        VigenteSi = new javax.swing.JRadioButton();
        IdCatedratico = new javax.swing.JComboBox();
        EditNombre = new javax.swing.JTextField();
        jLabel28 = new javax.swing.JLabel();
        jLabel29 = new javax.swing.JLabel();
        EditApellido = new javax.swing.JTextField();
        jLabel30 = new javax.swing.JLabel();
        jLabel31 = new javax.swing.JLabel();
        jLabel32 = new javax.swing.JLabel();
        jLabel33 = new javax.swing.JLabel();
        jLabel34 = new javax.swing.JLabel();
        EditAdminSi = new javax.swing.JRadioButton();
        EditAdminNo = new javax.swing.JRadioButton();
        Aceptar = new javax.swing.JButton();
        Cancelar = new javax.swing.JButton();
        jTaskPane1 = new com.l2fprod.common.swing.JTaskPane();
        jLabel21 = new javax.swing.JLabel();
        Descripcion = new javax.swing.JLabel();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        setTitle("Administracion de Catedratico");

        AdCat.addChangeListener(new javax.swing.event.ChangeListener() {
            public void stateChanged(javax.swing.event.ChangeEvent evt) {
                AdCatStateChanged(evt);
            }
        });

        jLabel27.setText("Buscar:");

        Buscadatos.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Todos Los Catedraticos", "Catedraticos Vigentes", "Catedraticos No Vigentes" }));

        Listacatedratico.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null}
            },
            new String [] {
                "Title 1", "Title 2", "Title 3", "Title 4"
            }
        ));
        jScrollPane1.setViewportView(Listacatedratico);

        javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
        jPanel3.setLayout(jPanel3Layout);
        jPanel3Layout.setHorizontalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel3Layout.createSequentialGroup()
                        .addGap(22, 22, 22)
                        .addComponent(jLabel27)
                        .addGap(18, 18, 18)
                        .addComponent(Buscadatos, javax.swing.GroupLayout.PREFERRED_SIZE, 385, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(jPanel3Layout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap(30, Short.MAX_VALUE))
        );
        jPanel3Layout.setVerticalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addGap(19, 19, 19)
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(Buscadatos, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel27))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 330, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        AdCat.addTab("Listar", jPanel3);

        jLabel1.setText("Nombre");

        jLabel2.setText("Apellido");

        jLabel3.setText("Profesion");

        jLabel4.setText("Telefono");

        jLabel5.setText("Direccion");

        jLabel6.setText("Email");

        jLabel7.setText("Fecha de Nacimiento");

        Nombre.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                NombreKeyPressed(evt);
            }
        });

        Apellido.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                ApellidoKeyPressed(evt);
            }
        });

        Profesion.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                ProfesionKeyPressed(evt);
            }
        });

        Telefono.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                TelefonoKeyPressed(evt);
            }
        });

        Direccion.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                DireccionKeyPressed(evt);
            }
        });

        Email.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                EmailKeyPressed(evt);
            }
        });

        jLabel8.setForeground(new java.awt.Color(255, 0, 0));
        jLabel8.setText("*");
        jLabel8.setToolTipText("Campo Obligatorio");
        jLabel8.addMouseMotionListener(new java.awt.event.MouseMotionAdapter() {
            public void mouseMoved(java.awt.event.MouseEvent evt) {
                jLabel8MouseMoved(evt);
            }
        });

        jLabel17.setForeground(new java.awt.Color(255, 0, 0));
        jLabel17.setText("*");
        jLabel17.setToolTipText("Campo Obligatorio");
        jLabel17.addMouseMotionListener(new java.awt.event.MouseMotionAdapter() {
            public void mouseMoved(java.awt.event.MouseEvent evt) {
                jLabel17MouseMoved(evt);
            }
        });

        jLabel18.setForeground(new java.awt.Color(255, 0, 0));
        jLabel18.setText("*");
        jLabel18.setToolTipText("Campo Obligatorio");
        jLabel18.addMouseMotionListener(new java.awt.event.MouseMotionAdapter() {
            public void mouseMoved(java.awt.event.MouseEvent evt) {
                jLabel18MouseMoved(evt);
            }
        });

        jLabel19.setForeground(new java.awt.Color(255, 0, 0));
        jLabel19.setText("*");
        jLabel19.setToolTipText("Campo Obligatorio");
        jLabel19.addMouseMotionListener(new java.awt.event.MouseMotionAdapter() {
            public void mouseMoved(java.awt.event.MouseEvent evt) {
                jLabel19MouseMoved(evt);
            }
        });

        jLabel20.setForeground(new java.awt.Color(255, 0, 0));
        jLabel20.setText("*");
        jLabel20.setToolTipText("Campo Obligatorio");
        jLabel20.addMouseMotionListener(new java.awt.event.MouseMotionAdapter() {
            public void mouseMoved(java.awt.event.MouseEvent evt) {
                jLabel20MouseMoved(evt);
            }
        });

        jLabel22.setText("Nombre Usuario:");

        NombreUsuario.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                NombreUsuarioKeyPressed(evt);
            }
        });

        jLabel23.setText("Contraseña:");

        Contraseña.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                ContraseñaKeyPressed(evt);
            }
        });

        jLabel24.setForeground(new java.awt.Color(255, 0, 0));
        jLabel24.setText("*");
        jLabel24.setToolTipText("Campo Obligatorio");
        jLabel24.addMouseMotionListener(new java.awt.event.MouseMotionAdapter() {
            public void mouseMoved(java.awt.event.MouseEvent evt) {
                jLabel24MouseMoved(evt);
            }
        });

        jLabel25.setForeground(new java.awt.Color(255, 0, 0));
        jLabel25.setText("*");
        jLabel25.setToolTipText("Campo Obligatorio");
        jLabel25.addMouseMotionListener(new java.awt.event.MouseMotionAdapter() {
            public void mouseMoved(java.awt.event.MouseEvent evt) {
                jLabel25MouseMoved(evt);
            }
        });

        jLabel26.setText("Administrador:");

        buttonGroup2.add(AdminSi);
        AdminSi.setText("Si");

        buttonGroup2.add(AdminNo);
        AdminNo.setText("No");

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                .addComponent(jLabel8, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addComponent(jLabel17, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addComponent(jLabel18, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel19, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addComponent(jLabel20, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addComponent(jLabel24, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel25, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addComponent(jLabel26)
                        .addGap(36, 36, 36)
                        .addComponent(AdminSi)
                        .addGap(18, 18, 18)
                        .addComponent(AdminNo)
                        .addContainerGap())
                    .addComponent(jLabel22)
                    .addComponent(jLabel23)
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(jPanel1Layout.createSequentialGroup()
                                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(jLabel2)
                                    .addComponent(jLabel1))
                                .addGap(72, 72, 72)
                                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(Apellido, javax.swing.GroupLayout.DEFAULT_SIZE, 291, Short.MAX_VALUE)
                                    .addComponent(Nombre, javax.swing.GroupLayout.DEFAULT_SIZE, 291, Short.MAX_VALUE)))
                            .addGroup(jPanel1Layout.createSequentialGroup()
                                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(jLabel7)
                                    .addComponent(jLabel3)
                                    .addComponent(jLabel5)
                                    .addComponent(jLabel4)
                                    .addComponent(jLabel6))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(Direccion, javax.swing.GroupLayout.DEFAULT_SIZE, 291, Short.MAX_VALUE)
                                    .addComponent(Telefono, javax.swing.GroupLayout.DEFAULT_SIZE, 291, Short.MAX_VALUE)
                                    .addComponent(Profesion, javax.swing.GroupLayout.DEFAULT_SIZE, 291, Short.MAX_VALUE)
                                    .addComponent(FechaNacimiento, javax.swing.GroupLayout.DEFAULT_SIZE, 291, Short.MAX_VALUE)
                                    .addComponent(Email, javax.swing.GroupLayout.DEFAULT_SIZE, 291, Short.MAX_VALUE)
                                    .addComponent(NombreUsuario, javax.swing.GroupLayout.DEFAULT_SIZE, 291, Short.MAX_VALUE)
                                    .addComponent(Contraseña, javax.swing.GroupLayout.DEFAULT_SIZE, 291, Short.MAX_VALUE))))
                        .addGap(58, 58, 58))))
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addGap(25, 25, 25)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(Nombre, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel8)
                    .addComponent(jLabel1))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel2)
                    .addComponent(Apellido, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel17))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jLabel7)
                        .addComponent(jLabel18))
                    .addComponent(FechaNacimiento, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jLabel3)
                        .addComponent(jLabel19))
                    .addComponent(Profesion, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel4)
                    .addComponent(jLabel20)
                    .addComponent(Telefono, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel5)
                    .addComponent(Direccion, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(Email, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel6))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel22)
                    .addComponent(NombreUsuario, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel24))
                .addGap(18, 18, 18)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel23)
                    .addComponent(Contraseña, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel25))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(AdminSi)
                    .addComponent(jLabel26)
                    .addComponent(AdminNo))
                .addContainerGap(33, Short.MAX_VALUE))
        );

        AdCat.addTab("Creacion", jPanel1);

        jLabel9.setText("Id Catedratico");

        jLabel10.setText("Nombre:");

        jLabel11.setText("Fecha de Nacimiento:");

        EditProfesion.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                EditProfesionKeyPressed(evt);
            }
        });

        jLabel12.setText("Profesion:");

        jLabel13.setText("Direccion:");

        EditTelefono.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                EditTelefonoKeyPressed(evt);
            }
        });

        jLabel14.setText("Telefono:");

        EditDireccion.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                EditDireccionActionPerformed(evt);
            }
        });
        EditDireccion.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                EditDireccionKeyPressed(evt);
            }
        });

        jLabel15.setText("Email:");

        EditEmail.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                EditEmailKeyPressed(evt);
            }
        });

        jLabel16.setText("Vigente:");

        buttonGroup1.add(VigenteNo);
        VigenteNo.setText("No");

        buttonGroup1.add(VigenteSi);
        VigenteSi.setText("si");

        IdCatedratico.addItemListener(new java.awt.event.ItemListener() {
            public void itemStateChanged(java.awt.event.ItemEvent evt) {
                IdCatedraticoItemStateChanged(evt);
            }
        });
        IdCatedratico.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                IdCatedraticoActionPerformed(evt);
            }
        });

        EditNombre.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                EditNombreActionPerformed(evt);
            }
        });
        EditNombre.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                EditNombreKeyPressed(evt);
            }
        });

        jLabel28.setForeground(new java.awt.Color(255, 0, 0));
        jLabel28.setText("*");
        jLabel28.setToolTipText("Campo Obligatorio");
        jLabel28.addMouseMotionListener(new java.awt.event.MouseMotionAdapter() {
            public void mouseMoved(java.awt.event.MouseEvent evt) {
                jLabel28MouseMoved(evt);
            }
        });

        jLabel29.setText("Apellido:");

        EditApellido.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                EditApellidoKeyPressed(evt);
            }
        });

        jLabel30.setForeground(new java.awt.Color(255, 0, 0));
        jLabel30.setText("*");
        jLabel30.setToolTipText("Campo Obligatorio");
        jLabel30.addMouseMotionListener(new java.awt.event.MouseMotionAdapter() {
            public void mouseMoved(java.awt.event.MouseEvent evt) {
                jLabel30MouseMoved(evt);
            }
        });

        jLabel31.setForeground(new java.awt.Color(255, 0, 0));
        jLabel31.setText("*");
        jLabel31.setToolTipText("Campo Obligatorio");
        jLabel31.addMouseMotionListener(new java.awt.event.MouseMotionAdapter() {
            public void mouseMoved(java.awt.event.MouseEvent evt) {
                jLabel31MouseMoved(evt);
            }
        });

        jLabel32.setForeground(new java.awt.Color(255, 0, 0));
        jLabel32.setText("*");
        jLabel32.setToolTipText("Campo Obligatorio");
        jLabel32.addMouseMotionListener(new java.awt.event.MouseMotionAdapter() {
            public void mouseMoved(java.awt.event.MouseEvent evt) {
                jLabel32MouseMoved(evt);
            }
        });

        jLabel33.setForeground(new java.awt.Color(255, 0, 0));
        jLabel33.setText("*");
        jLabel33.setToolTipText("Campo Obligatorio");
        jLabel33.addMouseMotionListener(new java.awt.event.MouseMotionAdapter() {
            public void mouseMoved(java.awt.event.MouseEvent evt) {
                jLabel33MouseMoved(evt);
            }
        });

        jLabel34.setText("Administrador:");

        buttonGroup2.add(EditAdminSi);
        EditAdminSi.setText("Si");

        buttonGroup2.add(EditAdminNo);
        EditAdminNo.setText("No");

        javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel28, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel32, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel33, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel31, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel30, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel10)
                            .addComponent(jLabel15)
                            .addComponent(jLabel13)
                            .addComponent(jLabel16)
                            .addComponent(jLabel34)
                            .addComponent(jLabel11)
                            .addComponent(jLabel12)
                            .addComponent(jLabel29)
                            .addComponent(jLabel14))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(jPanel2Layout.createSequentialGroup()
                                .addComponent(EditAdminSi)
                                .addGap(18, 18, 18)
                                .addComponent(EditAdminNo))
                            .addGroup(jPanel2Layout.createSequentialGroup()
                                .addComponent(VigenteSi)
                                .addGap(10, 10, 10)
                                .addComponent(VigenteNo))
                            .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                .addComponent(EditProfesion)
                                .addComponent(EditEmail)
                                .addComponent(EditDireccion)
                                .addComponent(IdCatedratico, 0, 300, Short.MAX_VALUE)
                                .addComponent(EditNombre)
                                .addComponent(EditApellido, javax.swing.GroupLayout.DEFAULT_SIZE, 304, Short.MAX_VALUE)
                                .addComponent(EditFechaNacimiento, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                .addComponent(EditTelefono))))
                    .addComponent(jLabel9))
                .addGap(149, 149, 149))
        );
        jPanel2Layout.setVerticalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addGap(19, 19, 19)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel9)
                    .addComponent(IdCatedratico, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(16, 16, 16)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(EditNombre, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel10)
                    .addComponent(jLabel28))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(EditApellido, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel29)
                    .addComponent(jLabel30))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(EditFechaNacimiento, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jLabel11)
                        .addComponent(jLabel31)))
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addGap(18, 18, 18)
                        .addComponent(jLabel32))
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(EditProfesion, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel12))))
                .addGap(12, 12, 12)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(EditTelefono, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel33)
                    .addComponent(jLabel14))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(EditDireccion, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel13))
                .addGap(14, 14, 14)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(EditEmail, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel15))
                .addGap(18, 18, 18)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel16)
                    .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(VigenteSi)
                        .addComponent(VigenteNo)))
                .addGap(18, 18, 18)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel34)
                    .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(EditAdminSi)
                        .addComponent(EditAdminNo)))
                .addGap(85, 85, 85))
        );

        AdCat.addTab("Editar", jPanel2);

        Aceptar.setText("Aceptar");
        Aceptar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                AceptarActionPerformed(evt);
            }
        });

        Cancelar.setText("Cancelar");
        Cancelar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                CancelarActionPerformed(evt);
            }
        });

        jLabel21.setBackground(new java.awt.Color(255, 255, 255));
        jLabel21.setFont(new java.awt.Font("Arial", 1, 14)); // NOI18N
        jLabel21.setForeground(new java.awt.Color(255, 255, 255));
        jLabel21.setText("Administracion de Catedratico");
        jTaskPane1.add(jLabel21);

        Descripcion.setForeground(new java.awt.Color(255, 255, 255));
        jTaskPane1.add(Descripcion);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addContainerGap(376, Short.MAX_VALUE)
                .addComponent(Aceptar)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(Cancelar)
                .addContainerGap())
            .addComponent(jTaskPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 538, Short.MAX_VALUE)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(AdCat, javax.swing.GroupLayout.PREFERRED_SIZE, 497, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(31, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addComponent(jTaskPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 62, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(AdCat, javax.swing.GroupLayout.DEFAULT_SIZE, 400, Short.MAX_VALUE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(Cancelar)
                    .addComponent(Aceptar))
                .addContainerGap())
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void NombreKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_NombreKeyPressed
    //System.out.print("jbjg");
        System.out.print(evt.getKeyCode());
        if(evt.getKeyCode()==10){
        this.Apellido.requestFocusInWindow();
      }
    }//GEN-LAST:event_NombreKeyPressed

    private void ApellidoKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_ApellidoKeyPressed
        if(evt.getKeyCode()==10){
        this.Profesion.requestFocusInWindow();
        this.FechaNacimiento.getCalendarButton().doClick();
      }
    }//GEN-LAST:event_ApellidoKeyPressed

    private void ProfesionKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_ProfesionKeyPressed
        if(evt.getKeyCode()==10){
        this.Telefono.requestFocusInWindow();

      }
    }//GEN-LAST:event_ProfesionKeyPressed

    private void DireccionKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_DireccionKeyPressed
         if(evt.getKeyCode()==10){
        this.Email.requestFocusInWindow();

      } // TODO add your handling code here:
    }//GEN-LAST:event_DireccionKeyPressed

    private void TelefonoKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_TelefonoKeyPressed
  if(evt.getKeyCode()==10){
        this.Direccion.requestFocusInWindow();

      }        // TODO add your handling code here:
    }//GEN-LAST:event_TelefonoKeyPressed

    private void EmailKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_EmailKeyPressed
         if(evt.getKeyCode()==10){
        this.Cancelar.requestFocusInWindow();

      } // TODO add your handling code here:
    }//GEN-LAST:event_EmailKeyPressed

    private void jLabel8MouseMoved(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabel8MouseMoved
        // TODO add your handling code here:
    }//GEN-LAST:event_jLabel8MouseMoved

    private void jLabel17MouseMoved(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabel17MouseMoved
        // TODO add your handling code here:
    }//GEN-LAST:event_jLabel17MouseMoved

    private void jLabel18MouseMoved(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabel18MouseMoved
        // TODO add your handling code here:
    }//GEN-LAST:event_jLabel18MouseMoved

    private void jLabel19MouseMoved(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabel19MouseMoved
        // TODO add your handling code here:
    }//GEN-LAST:event_jLabel19MouseMoved

    private void jLabel20MouseMoved(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabel20MouseMoved
        // TODO add your handling code here:
    }//GEN-LAST:event_jLabel20MouseMoved

    private void IdCatedraticoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_IdCatedraticoActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_IdCatedraticoActionPerformed

    private void jLabel28MouseMoved(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabel28MouseMoved
        // TODO add your handling code here:
    }//GEN-LAST:event_jLabel28MouseMoved

    private void EditDireccionActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_EditDireccionActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_EditDireccionActionPerformed

    private void jLabel30MouseMoved(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabel30MouseMoved
        // TODO add your handling code here:
    }//GEN-LAST:event_jLabel30MouseMoved

    private void jLabel31MouseMoved(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabel31MouseMoved
        // TODO add your handling code here:
    }//GEN-LAST:event_jLabel31MouseMoved

    private void jLabel32MouseMoved(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabel32MouseMoved
        // TODO add your handling code here:
    }//GEN-LAST:event_jLabel32MouseMoved

    private void jLabel33MouseMoved(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabel33MouseMoved
        // TODO add your handling code here:
    }//GEN-LAST:event_jLabel33MouseMoved

    private void EditNombreActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_EditNombreActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_EditNombreActionPerformed

    private void AdCatStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_AdCatStateChanged
    if(sexistend ){
            if(this.AdCat.getSelectedIndex()==0){
                this.Descripcion.setText("Lista de Catedraticos");
                this.Aceptar.setEnabled(false);
                this.Cancelar.setEnabled(false);
            }else if(this.AdCat.getSelectedIndex()==1){
                this.Descripcion.setText("Crear nuevo Catedratico, los campos con * son obligatorios");
                this.Aceptar.setEnabled(true);
                this.Cancelar.setEnabled(true);
            }else if(this.AdCat.getSelectedIndex()==2){
                this.Descripcion.setText("Editar un Catedratico, los campos con * son obligatorios");
                this.Aceptar.setEnabled(true);
                this.Cancelar.setEnabled(true);
            }
        }//else{this.AdCat.setSelectedIndex(1);}        // TODO add your handling code here:
    }//GEN-LAST:event_AdCatStateChanged

    private void IdCatedraticoItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_IdCatedraticoItemStateChanged
        // TODO add your handling code here:
        if(sban==1){
            CargarDatosEdicion();
        }
    }//GEN-LAST:event_IdCatedraticoItemStateChanged

    private void AceptarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_AceptarActionPerformed
        Aceptar();
    }//GEN-LAST:event_AceptarActionPerformed

    private void CancelarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_CancelarActionPerformed
        Cancelar();
    }//GEN-LAST:event_CancelarActionPerformed

    private void EditNombreKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_EditNombreKeyPressed
 if(evt.getKeyCode()==10){
            this.EditApellido.requestFocusInWindow();
        }        // TODO add your handling code here:
    }//GEN-LAST:event_EditNombreKeyPressed

    private void EditApellidoKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_EditApellidoKeyPressed
 if(evt.getKeyCode()==10){
        this.EditProfesion.requestFocusInWindow();
        this.EditFechaNacimiento.getCalendarButton().doClick();
      }        // TODO add your handling code here:
    }//GEN-LAST:event_EditApellidoKeyPressed

    private void EditProfesionKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_EditProfesionKeyPressed
        if(evt.getKeyCode()==10){
        this.EditTelefono.requestFocusInWindow();

      }        // TODO add your handling code here:
    }//GEN-LAST:event_EditProfesionKeyPressed

    private void EditTelefonoKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_EditTelefonoKeyPressed
        if(evt.getKeyCode()==10){
        this.EditDireccion.requestFocusInWindow();

      }
    }//GEN-LAST:event_EditTelefonoKeyPressed

    private void EditDireccionKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_EditDireccionKeyPressed
        if(evt.getKeyCode()==10){
        this.EditEmail.requestFocusInWindow();

      }        // TODO add your handling code here:
    }//GEN-LAST:event_EditDireccionKeyPressed

    private void EditEmailKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_EditEmailKeyPressed
        if(evt.getKeyCode()==10){
        this.Cancelar.requestFocusInWindow();

      }        // TODO add your handling code here:
    }//GEN-LAST:event_EditEmailKeyPressed

    private void NombreUsuarioKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_NombreUsuarioKeyPressed
        if(evt.getKeyCode()==10){
            this.Contraseña.requestFocusInWindow();
        }
}//GEN-LAST:event_NombreUsuarioKeyPressed

    private void jLabel24MouseMoved(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabel24MouseMoved
        // TODO add your handling code here:
    }//GEN-LAST:event_jLabel24MouseMoved

    private void jLabel25MouseMoved(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabel25MouseMoved
        // TODO add your handling code here:
    }//GEN-LAST:event_jLabel25MouseMoved

    private void ContraseñaKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_ContraseñaKeyPressed
        if(evt.getKeyCode()==10){
            this.Cancelar.requestFocusInWindow();
        }
}//GEN-LAST:event_ContraseñaKeyPressed

    /**
    * @param args the command line arguments
    */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                JAdminCatedratico dialog = new JAdminCatedratico(new javax.swing.JFrame(), true);
                dialog.addWindowListener(new java.awt.event.WindowAdapter() {
                    public void windowClosing(java.awt.event.WindowEvent e) {
                        System.exit(0);
                    }
                });
                dialog.setVisible(true);
            }
        });
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton Aceptar;
    private javax.swing.JTabbedPane AdCat;
    private javax.swing.JRadioButton AdminNo;
    private javax.swing.JRadioButton AdminSi;
    private javax.swing.JTextField Apellido;
    private javax.swing.JComboBox Buscadatos;
    private javax.swing.JButton Cancelar;
    private javax.swing.JTextField Contraseña;
    private javax.swing.JLabel Descripcion;
    private javax.swing.JTextField Direccion;
    private javax.swing.JRadioButton EditAdminNo;
    private javax.swing.JRadioButton EditAdminSi;
    private javax.swing.JTextField EditApellido;
    private javax.swing.JTextField EditDireccion;
    private javax.swing.JTextField EditEmail;
    private com.toedter.calendar.JDateChooser EditFechaNacimiento;
    private javax.swing.JTextField EditNombre;
    private javax.swing.JTextField EditProfesion;
    private javax.swing.JTextField EditTelefono;
    private javax.swing.JTextField Email;
    private com.toedter.calendar.JDateChooser FechaNacimiento;
    private javax.swing.JComboBox IdCatedratico;
    private javax.swing.JTable Listacatedratico;
    private javax.swing.JTextField Nombre;
    private javax.swing.JTextField NombreUsuario;
    private javax.swing.JTextField Profesion;
    private javax.swing.JTextField Telefono;
    private javax.swing.JRadioButton VigenteNo;
    private javax.swing.JRadioButton VigenteSi;
    private javax.swing.ButtonGroup buttonGroup1;
    private javax.swing.ButtonGroup buttonGroup2;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel10;
    private javax.swing.JLabel jLabel11;
    private javax.swing.JLabel jLabel12;
    private javax.swing.JLabel jLabel13;
    private javax.swing.JLabel jLabel14;
    private javax.swing.JLabel jLabel15;
    private javax.swing.JLabel jLabel16;
    private javax.swing.JLabel jLabel17;
    private javax.swing.JLabel jLabel18;
    private javax.swing.JLabel jLabel19;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel20;
    private javax.swing.JLabel jLabel21;
    private javax.swing.JLabel jLabel22;
    private javax.swing.JLabel jLabel23;
    private javax.swing.JLabel jLabel24;
    private javax.swing.JLabel jLabel25;
    private javax.swing.JLabel jLabel26;
    private javax.swing.JLabel jLabel27;
    private javax.swing.JLabel jLabel28;
    private javax.swing.JLabel jLabel29;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel30;
    private javax.swing.JLabel jLabel31;
    private javax.swing.JLabel jLabel32;
    private javax.swing.JLabel jLabel33;
    private javax.swing.JLabel jLabel34;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JScrollPane jScrollPane1;
    private com.l2fprod.common.swing.JTaskPane jTaskPane1;
    // End of variables declaration//GEN-END:variables

}
